<template>
  <div class="rumour">
    <div class="header">
      <div class="desc">新型冠状病毒肺炎</div>
      <div class="name">谣言终结榜</div>
    </div>
    <div class="content">
      <div class="card" v-for="(item, index) in rumourList" :key="index">
        <div class="type">
          <div
            class="num"
            :style="{ background: item.rumorType ? '#72D36D' : '#e5593f' }"
          >
            {{ index + 1 }}
          </div>
          <img
            v-if="!item.rumorType"
            class="img img-rumour"
            alt="type"
            src=""
          />
          <img
            v-else
            class="img img-truth"
            alt="type"
            src=""
          />
        </div>
        <div class="title">{{ item.title }}</div>
        <div class="summary">
          {{ item.mainSummary }}
          <div class="detail">{{ item.body }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Rumour',
  data() {
    return {
      rumourList: []
    }
  },
  mounted() {
    this.getTopRumours()
  },
  methods: {
    async getTopRumours() {
      const res = await this.$api.dxy.rumour()
      // console.log(res.data)
      this.rumourList = [...res.data.data]
    }
  }
}
</script>

<style lang="scss" scoped>
.rumour {
  width: 100%;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 2% 3.5%;
  background: #fff;

  .header {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    .desc {
      width: 150px;
      font-size: 90%;
      font-weight: bold;
      line-height: 160%;
      border: 1px solid #cecece;
      border-radius: 100px;
    }

    .name {
      font-size: 200%;
      font-weight: bold;
    }
  }

  .content {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 2% 0;

    .card {
      width: 100%;
      margin: 5px;
      padding: 25px 15px;
      background: #2639b2;
      border: none;
      border-radius: 12px;

      .type {
        width: 100%;
        height: 40px;
        display: flex;
        justify-content: flex-start;
        margin-bottom: 10px;

        .num {
          height: 40px;
          display: flex;
          justify-content: center;
          align-items: center;
          margin-right: 10px;
          padding: 8px;
          color: #fff;
          font-size: 140%;
          font-weight: bold;
          // background: #e5593f;
          border-radius: 3px;
        }

        .img {
          height: 40px !important;
        }
      }

      .title {
        width: 100%;
        margin-bottom: 15px;
        padding-right: 40px;
        display: -webkit-box;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        color: #fff;
        font-size: 130%;
        font-weight: bold;
        text-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.08);
        text-align: left;
      }

      .summary {
        width: 100%;
        min-height: 20px;
        padding: 10px;
        background: #fff;
        font-size: 100%;
        font-weight: bold;
        text-align: left;
        border-radius: 8px;

        .detail {
          margin-top: 5px;
          color: #999;
          font-size: 80%;
          font-weight: normal;
        }
      }
    }
  }
}
</style>
